<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8"%>
<%@ page import="oneroom.admin.oneroom.roomModel" %>
<jsp:useBean id="dao" scope="page" class="oneroom.admin.oneroom.roomDao" />
<jsp:useBean id="codeDao" scope="page" class="oneroom.admin.code.codeDao" />
<%
	String redirectUrl = "";
	if (session.getAttribute("id") != null &&
			((String)session.getAttribute("id")).equals("") == false) {
	} else {
		redirectUrl = "/room/member/login.jsp";
		response.sendRedirect(redirectUrl);
	}
	//기본 세트 값 시작
	String searchGubn = request.getParameter("searchGubn") == null ? "" : request.getParameter("searchGubn");
	String searchValue = request.getParameter("searchValue") == null ? "" : request.getParameter("searchValue");
	int     giSelectPage  	= Integer.parseInt(request.getParameter("txtSelectPage") == null ? "0" :request.getParameter("txtSelectPage"));			//현재 선택된 페이지 저장
	int     giSelectBlock 	= Integer.parseInt(request.getParameter("txtSelectBlock") == null ? "0" :request.getParameter("txtSelectBlock"));			//현재 선택된 블락페이지 저장
	//기본 세트 값 끝

	String oneroom_seq = request.getParameter("oneroom_seq") == null ? "" : request.getParameter("oneroom_seq");
	roomModel model = dao.getView(oneroom_seq);
	
	//코드 값을 코드 명으로 변경
	model.setRoomkind(codeDao.getDtlName("500",model.getRoomkind()));
	String subWay = model.getSubway1();
	model.setSubway1(codeDao.getDtlName("001",model.getSubway1()));
	model.setSubway2(codeDao.getDtlName(subWay,model.getSubway2()));
	model.setHeating(codeDao.getDtlName("300",model.getHeating()));
	model.setAirconditioning(codeDao.getDtlName("301",model.getAirconditioning()));
	int university = Integer.parseInt(model.getUniversity1() == "" ? "0" :model.getUniversity1()) ;
	university = 400 + university;
	model.setUniversity1(codeDao.getDtlName("400",model.getUniversity1()));
	model.setUniversity2(codeDao.getDtlName(university+"",model.getUniversity2()));
	
	String[] furniture = model.getFurniture1().split(",");
	String furnitureName = "";
	if(!model.getFurniture1().equals("")){		
		for(int i = 0; i<furniture.length; i++){
			furnitureName = furnitureName+codeDao.getDtlName("302",furniture[i])+" ";
		}
	}
	model.setFurniture1(furnitureName);
	
	String[] appliances = model.getAppliances1().split(",");
	String appliancesName = "";
	if(!model.getAppliances1().equals("")){		
		for(int i = 0; i<appliances.length; i++){
			appliancesName = appliancesName+codeDao.getDtlName("303",appliances[i])+" ";
		}
	}
	model.setAppliances1(appliancesName);
	
	String[] kitchen = model.getKitchen1().split(",");
	String kitchenName = "";
	if(!model.getKitchen1().equals("")){		
		for(int i = 0; i<kitchen.length; i++){
			kitchenName = kitchenName+codeDao.getDtlName("304",kitchen[i])+" ";
		}
	}
	model.setKitchen1(kitchenName);
	
	String[] security = model.getSecurity1().split(",");
	String securityName = "";
	if(!model.getSecurity1().equals("")){	
		for(int i = 0; i<security.length; i++){
			securityName = securityName+codeDao.getDtlName("305",security[i])+" ";
		}
	}
	model.setSecurity1(securityName);
	
	//String[] facility = model.getFacility1().split(",");
	//String facilityName = "";
	//for(int i = 0; i<facility.length; i++){
	//	facilityName = facilityName+codeDao.getDtlName("306",facility[i])+" ";
	//}
	//model.setFacility1(facilityName);
	

%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>원룸몬스터</title>

<link href="/room/css/all.css" rel="stylesheet" type="text/css" />
<script src="/room/script/swfobject_modified.js" type="text/javascript"></script>
<script src="/room/script/common.js" type="text/javascript"></script>
<script src="/room/script/jquery-1.3.2.min.js" type="text/javascript" ></script>
<script type="text/javascript">
<!--
$(document).ready(function(){
	
	$('#btList').click(function() {
		document.getElementById("frm").action = "room_list.jsp";
		document.getElementById("frm").submit();
	});
	$('#btDelete').click(function() {
		document.getElementById("gubun").value = "D";
		document.getElementById("frm").action = "room_dbx.jsp";
		document.getElementById("frm").submit();
	});
	
});
function goWrite(){
	var frm = document.frm;
	frm.submit();
}
function display(no){
    for(var i=1; i<=2; i++){
        document.getElementById("charter_type"+i).style.display="none";
    }
    document.getElementById("charter_type"+no).style.display="block";
    /*if(no == "2"){
    	document.getElementById("charter_name").innerHTML = "월세";
    }else{
    	document.getElementById("charter_name").innerHTML = "전세";
    }*/
}
//onload="display(<%=model.getCharter() == "J" ? "1" :"2"%>);"
//-->
</script>	
</head>

<body >
<div align="center"> 

 <div id="content">

<!----------------왼쪽---------------->  
<%@ include file="/room/common/left.jsp" %>
<!----------------왼쪽끝---------------->  


<!----------------가운데 시작----------------> 
 <div id="rgt">
  <div id="con01">
   <div class="top bb1"><img src="/room/img/txt_top.gif" /></div>
   <div id="sch-adress"></div>
   
<div class="list">
 <div class="pb10"><img src="/room/img/line_blue.gif" width="32" height="2" /></div>
      <div class="pb20"><span style="font-size:11px;">Home >회원> <span style="color:#000;">마이페이지</span></span></div>
      <div> 
       <div class="tit">my 매물리스트 </div>   	
      </div>
      
     <!---------------- 내용시작----------------> 
				<form action="room_update.jsp" name="frm" id="frm" method="post">
				<input type="hidden" name="searchGubn" id="searchGubn"  value="<%=searchGubn %>"/>
				<input type="hidden" name="searchValue" id="searchValue"  value="<%=searchValue %>"/>
				<input type="hidden" name="txtSelectPage" id="txtSelectPage"  value="<%=giSelectPage %>"/>
				<input type="hidden" name="txtSelectBlock" id="txtSelectBlock" value="<%=giSelectBlock %>"/> 
				<input type="hidden" name="oneroom_seq" id="oneroom_seq" value="<%=oneroom_seq %>"/>
				<input type="hidden" name="gubun" id="gubun" value=""/>
				<!-- 삭제 관련된 변수 시작 -->
				<input type="hidden" name="photo1_path" 	value="<%=model.getPhoto1()%>"/>
				<input type="hidden" name="photo1_small" 	value="<%=model.getPhoto1_small()%>"/>
				<input type="hidden" name="photo1_big" 		value="<%=model.getPhoto1_big()%>"/>
				<input type="hidden" name="photo2_path" 	value="<%=model.getPhoto2()%>"/>
				<input type="hidden" name="photo2_small" 	value="<%=model.getPhoto2_small()%>"/>
				<input type="hidden" name="photo2_big" 		value="<%=model.getPhoto2_big()%>"/>
				<input type="hidden" name="photo3_path" 	value="<%=model.getPhoto3()%>"/>
				<input type="hidden" name="photo3_small" 	value="<%=model.getPhoto3_small()%>"/>
				<input type="hidden" name="photo3_big" 		value="<%=model.getPhoto3_big()%>"/>
				<input type="hidden" name="photo4_path" 	value="<%=model.getPhoto4()%>"/>
				<input type="hidden" name="photo4_small" 	value="<%=model.getPhoto4_small()%>"/>
				<input type="hidden" name="photo4_big"		value="<%=model.getPhoto4_big()%>"/>
				<input type="hidden" name="photo5_path" 	value="<%=model.getPhoto5()%>"/>
				<input type="hidden" name="photo5_small" 	value="<%=model.getPhoto5_small()%>"/>
				<input type="hidden" name="photo5_big" 		value="<%=model.getPhoto5_big()%>"/>
				<input type="hidden" name="photo6_path" 	value="<%=model.getPhoto6()%>"/>
				<input type="hidden" name="photo6_small" 	value="<%=model.getPhoto6_small()%>"/>
				<input type="hidden" name="photo6_big" 		value="<%=model.getPhoto6_big()%>"/>
				<!-- 삭제 관련되 변수 끝 -->
				<!-- 실제적인 리스트 시작 -->
				<div class="list">
				<table  width="167" border="0" cellspacing="0" cellpadding="0">
				  <tr>
				    <td><p class="btn_b87" id="tap03">기본정보</p></td>
				  </tr>
				</table>
				<table width="565" border="0" cellspacing="0" cellpadding="0">
				<col width="15%" />
				<col width="18%" />
				<col width="15%" />
				<col width="18%" />
				<col width="15%" />
				<col width="19%" />
				  <tr>
				    <td class="ac fw bt2 bb1 h30 bg_g">주소</td>
				    <td colspan="5" class="bt2 bb1 h30 pl10 ">
				    <%=model.getAddress1() %>
					<%=model.getAddress2() %>
					<%=model.getAddress3() %>
					<%=model.getAddress4() %>
					<%=model.getAddress5() %>
					<!-- 
				    <td class="ac fw bt2 bb1 h30 bg_g">번지</td>
				    <td class="bt2 bb1 h30 pl10 "><%//=model.getZipcode1() %> ~ <%//=model.getZipcode2() %></td>
				     -->				
				    </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">방수</td>
				    <td colspan="3" class=" bb1 h30 pl10"><%=model.getRoomnumber() %> 개</td>
				     <td class="ac fw bb1 h30 bg_g">매물종류</td>
				    <td class="ac bb1 h30"><%=model.getRoomkind() %></td>
				  </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">평수</td>
				    <td colspan="3" class=" bb1 h30 pl10"><%=model.getRoomarea() %>평</td>
				    <td class="ac fw bb1 h30 bg_g">임대형태</td>
				    <td class="bb1 h30 pl10">
				    <input type="radio" name="charter" value="J" disabled="disabled" <%if(model.getCharter().equals("J")){%>checked="checked"<%} %> onclick="display('1');"/>전세 
					<input type="radio" name="charter" value="W" disabled="disabled" <%if(model.getCharter().equals("W")){%>checked="checked"<%} %> onclick="display('2');"/>월세
					</td>				    
				  </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">층</td>
				    <td colspan="3" class=" bb1 h30 pl10"><%=model.getRoomfloor1() %> / <%=model.getRoomfloor2() %></td>
				    <td class="ac fw bb1 h30 bg_g"><span id="charter_name"><%if(model.getCharter().equals("J")){%>전세<%}else{ %>월세<%} %></span></td>
				    <td class="bb1 h30  pl10">
					<div id="charter_type1"  style="display:<%if(model.getCharter().equals("J")){%>block<%}else{ %>none<%} %>;">
					<%=model.getRoommoney() %> 만원
					</div>
					<div id="charter_type2"  style="display:<%if(model.getCharter().equals("W")){%>block<%}else{ %>none<%} %>;">
					보증 : <%=model.getRoommonth1() %> 만원 /<br/> 
					월세 : <%=model.getRoommonth2() %> 만원
					</div>					
					</td>
				  </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">주차</td>
				    <td colspan="3" class=" bb1 h30 pl10"><%=model.getCar() %>대</td>
				    <td class="ac fw bb1 h30 bg_g">관리비</td>
				    <td class="ac bb1 h30"><%=model.getManagemoney() %> 만원</td>				    
				  </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">매물옵션</td>
				    <td colspan="5" class=" bb1 h30 pl10"><%if(model.getRoomoption().equals("D")){%>직거래<%}else if(model.getRoomoption().equals("M")){%>반값중개<%}else if(model.getRoomoption().equals("G")){%>일반중개<%} %>&nbsp;</td>
				  </tr> 				  
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">지하철</td>
				    <td colspan="5" class="bb1 h30 pl10 ">
				    <%=model.getSubway1() %> <%=model.getSubway2() %>역 <%=model.getSubway3() %>분거리
				  </tr>				  
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">대학교</td>
				    <td colspan="3" class="bb1 h30 pl10 ">
				    <%=model.getUniversity1() %>
					<%=model.getUniversity2() %>
					<%=model.getUniversity3() %>
					</td>
				    <td class="ac fw bb1 h30 bg_g">입주가능일</td>
				    <td class="bb1 h30 pl10 ">
					<%=model.getLease() %> : 
					<%=model.getLeaseyear() %>
					<%=model.getLeasemonth() %>
					<%=model.getLeaseday() %>
					</td>
				  </tr>				  
				</table>
				</div>			
					
				<br/>
				<div class="list">
				<table  width="167" border="0" cellspacing="0" cellpadding="0">
				  <tr>
				    <td><p class="btn_b87" id="tap03">옵션정보</p></td>
				  </tr>
				</table> 
				<table width="565" border="0" cellspacing="0" cellpadding="0">
				<col width="15%" />
				<col width="35%" />
				<col width="15%" />
				<col width="35%" />
				  <tr>
				     <td class="bt2 bb1 h30 pl10">▶ 난방시설 : <%=model.getHeating() %>&nbsp;&nbsp;&nbsp;▶ 냉방시설 : <%=model.getAirconditioning() %>&nbsp;&nbsp;&nbsp;
					</td>
				  </tr>
				  <tr>
				     <td class="bb1 h30 pl10">▶ 가구 : 
				    <%=model.getFurniture1() %>
					<%=model.getFurniture2() %>
					<%=model.getFurniture3() %>
					<%=model.getFurniture4() %>
					</td>
				  </tr>
				  <tr>
				     <td class="bb1 h30 pl10">▶ 가전 :  
					<%=model.getAppliances1() %>
					<%=model.getAppliances2() %>
					<%=model.getAppliances3() %>
					<%=model.getAppliances4() %>
					<%=model.getAppliances5() %>
					<%=model.getAppliances6() %>
					<%=model.getAppliances7() %>
				     </td>
				  </tr>
				  <tr>
				     <td class="bb1 h30 pl10">▶ 주방/욕실 :  
					<%=model.getKitchen1() %>
					<%=model.getKitchen2() %>
					<%=model.getKitchen3() %>
					<%=model.getKitchen4() %>
					<%=model.getKitchen5() %>
				     </td>
				  </tr>
				  <tr>
				     <td class="bb1 h30 pl10">▶ 무료 :  
					<%=model.getSecurity1() %>
					<%=model.getSecurity2() %>
					<%=model.getSecurity3() %>
					<%=model.getSecurity4() %>
					<%=model.getSecurity5() %>
					<%=model.getSecurity6() %>
					</td>
				  </tr>
				  <!-- tr>
				     <td class="bb1 h30 pl10">▶ 주변시설 :  
					<%//=model.getFacility1() %>
					<%//=model.getFacility2() %>
					<%//=model.getFacility3() %>
					<%//=model.getFacility4() %>
					<%//=model.getFacility5() %>
					</td>
				  </tr-->
				</table>
				</div>
				<br/>
				
				<div class="list">
				<table  width="167" border="0" cellspacing="0" cellpadding="0">
				  <tr>
				    <td><p class="btn_b87" id="tap03">소개</p></td>
				  </tr>
				</table> 
				<table width="565" border="0" cellspacing="0" cellpadding="0">
				<col width="15%" />
				<col width="35%" />
				<col width="15%" />
				<col width="35%" />
				  <tr>
				    <td class="ac fw bt2 bb1 h30 bg_g">제목</td>
				    <td colspan="3" class="bt2 bb1 h30 pl10 ">
				    <%=model.getTitle() %>
				    </tr>
				  <tr>
				    <td class="ac fw bb1 h30 bg_g">작성자</td>
				    <td  class=" bb1 h30 pl10">&nbsp;<%=model.getPerson() %></td>
				     <td class="ac fw bb1 h30 bg_g">연락처</td>
				    <td class="ac bb1 h30"><%=model.getTel1() %> - <%=model.getTel2() %> - <%=model.getTel3() %></td>
				  </tr>
				  <tr>
				     <td colspan="4" class="bb1 h30 pl10 lh pt10 pb10"><%=model.getContent().replaceAll("\n","</br>") %>
					</td>
				   </tr>				  
				</table>
				</div>
				<br/>	
				
				<div class="list">
				<div><img src="/room/img/tab_option.gif"  /><!-- 사진등록 --></div>
				<table width="565" border="0" cellspacing="0" cellpadding="0">
				<col width="50%" />
				<col width="50%" />
				  <tr>
				     <td class="bt2 bb1 h30 pl10">&nbsp;<%if(!model.getPhoto1_small().equals("")){ %><img src="/download/<%=model.getPhoto1_small() %>?name=<%=model.getPhoto1_small() %>&kind=img" /><%} %>
					</td>
				     <td class="bt2 bb1 h30 pl10">&nbsp;<%if(!model.getPhoto2_small().equals("")){ %><img src="/download/<%=model.getPhoto2_small() %>?name=<%=model.getPhoto2_small() %>&kind=img" /><%} %>
					</td>					
				  </tr>
				  <tr>
				     <td class="bb1 h30 pl10">&nbsp;<%if(!model.getPhoto3_small().equals("")){ %><img src="/download/<%=model.getPhoto3_small() %>?name=<%=model.getPhoto3_small() %>&kind=img" /><%} %>
					</td>
				     <td class="bb1 h30 pl10">&nbsp;<%if(!model.getPhoto4_small().equals("")){ %><img src="/download/<%=model.getPhoto4_small() %>?name=<%=model.getPhoto4_small() %>&kind=img" /><%} %>
					</td>
				  </tr>
				  <tr>				  
				     <td class="bb1 h30 pl10">&nbsp;<%if(!model.getPhoto5_small().equals("")){ %><img src="/download/<%=model.getPhoto5_small() %>?name=<%=model.getPhoto5_small() %>&kind=img" /><%} %>
					</td>
				     <td class="bb1 h30 pl10">&nbsp;<%if(!model.getPhoto6_small().equals("")){ %><img src="/download/<%=model.getPhoto6_small() %>?name=<%=model.getPhoto6_small() %>&kind=img" /><%} %>
					</td>
				  </tr>				  
				</table>
				</div>
				<br/>	



				<!-- 실제적인 리스트 끝 -->
			<table border="0" cellspacing="0" cellpadding="0">
			  <tr>
			    <td style="padding-left:10px;">
				  <a class="d" href="#"  onclick="goWrite();"><div class="btn_b47">수정</div></a>
				</td>
			    <td style="padding-left:10px;">
				  <a class="d" href="#" id="btDelete"><div class="btn_g47">삭제</div></a>
				</td>
			    <td style="padding-left:10px;">
				  <a class="d" href="#" id="btList"><div class="btn_b47">목록</div></a>
				</td>
			  </tr>
			</table>				
				</form>
</div>
</div>
<!----------------가운데 끝---------------->


<!----------------오른쪽 시작---------------->  
<%@ include file="/room/common/right.jsp" %>  
<!----------------오른쪽 끝---------------->
</div>


<!-------------푸터영역----------> 
<%@ include file="/room/common/footer.jsp" %> 
<!-------------푸터영역----------> 
<script type="text/javascript">
swfobject.registerObject("FlashID");
</script>
</body>
</html>